# -*- coding: iso-8859-1 -*-
#
#    This is part of Malvinas Argentinas Messenger
#
#    Malvinas Argentinas Messenger is free software; you can redistribute
#    it and/or modify it under the terms of the GNU General Public License
#    as published by the Free Software Foundation; either version 2 of the
#    License, or (at your option) any later version.
#
#    Malvinas Argentinas Messenger is distributed in the hope that it will be
#    useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Malvinas Argentinas Messenger; if not, write to the Free
#    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
#    MA  02110-1301  USA

import curses

class Win:
	def __init__(self, rows, cols, y, x):
		self.y = y
		self.x = x
		self.rows = rows
		self.cols = cols
		self.w = curses.newwin(rows, cols, y, x)
		self.w.scrollok(1)
	
	def resize(self, rows, cols, y, x):
		self.w = curses.newwin(rows, cols, y, x)
		self.x = x
		self.y = y
		self.rows = rows
		self.cols = cols
		self.w.scrollok(1)

	def addch(self, char, attr = None):
		if attr:
			self.w.addch(char, attr)
		else:
			self.w.addch(char)

	def addstr(self, text, attr = None):
		if attr:
			self.w.addstr(text, attr)
		else:
			self.w.addstr(text)

	def erase(self):
    		self.w.erase()

	def refresh(self):
    		self.w.refresh()

	def lineH(self, value, attrib):
	        self.w.hline(curses.ACS_HLINE + attrib, value)

	def lineV(self, value, attrib):
	        self.w.vline(curses.ACS_VLINE + attrib, value)

	def leaveok(self, value):
		self.w.leaveok(value)

	def move(self, y, x):
		self.w.move(y, x)
